$(function(){
    if($.browser.msie){
        $('.list-container ul.entries li a').live('mouseenter',function(){
            $(this).children('div.title').show();
        }).live('mouseleave',function(){
            $(this).children('div.title').hide();
        });
    }
    
    
    var ajaxFill = new Z.AjaxFill({
        url: Z.url('/entry/records/'+TYPE,true),
        templates: {
            list: '<li>\
                        <a href="${SITE_URL}/index.php/entry/show/${TYPE}/${id}">\
                            <img src="${SITE_URL}/assets/uploads/${$item.thumb(file_name)}"/>\
                            <div class="title">${title}</div>\
                        </a>\
                    </li>',
            none: '<li>暂无项目</li>',
            loading: '<li style="text-align:center;"><img src="/assets/img/backend/loading.gif"/></li>',
            methods: {
                thumb: function(fileName){
                    return (fileName||'').replace(/\.(jpg|bmp|gif|png|jpeg|gif)$/,'_thumb.$1');
                }
            }
        },
        containers: {
            list: $('.list-container ul'),
            pageLinks: $('.list-container .page-links')
        },
        data : {
            page: 1,
            pageSize: 25
        },
        after: function(){
            Z.alignImage($('.list-container ul.entries li a img'),140,90);
        }
    });
    
    ajaxFill.request();
    
     $('.search-container a').click(function(){
        if(LANG == 'en'){
            ajaxFill.request({
                title_en : $(this).prev().val()
            });
        }else{
            ajaxFill.request({
                title : $(this).prev().val()
            });
        }
    });
});